#include "svgwidget.h"

SvgWidget::SvgWidget(QWidget* parent):QSvgWidget(parent){
    render =renderer();
}
void SvgWidget::wheelEvent(QWheelEvent *event){
    const double diff = 0;
    QSize size = render->defaultSize();
    int width = size.width();
    int height  = size.height();
    if(event->delta() >0){      // delta()用于获取滚轮滚动的距离值，通过该值来判定滚轮滚动的方向
        width = int(this->width() + this->width() * diff);
        height = int(this->height() + this->height() * diff);
    }else{
        width = int(this->width() - this->width() * diff);
        height = int(this->height() - this->height() * diff);
    }
    resize(width, height);    // 应用新的长、宽值对图片进行resize
}
